package com.kunpan.admin.common.utils.file;

/**
 * 媒体类型工具类
 *
 * @author ruoyi
 */
public class MimeTypeUtils {
    public static final String IMAGE_PNG = "image/png";

    public static final String IMAGE_JPG = "image/jpg";

    public static final String IMAGE_JPEG = "image/jpeg";

    public static final String IMAGE_BMP = "image/bmp";

    public static final String IMAGE_GIF = "image/gif";

    public static final String[] IMAGE_EXTENSION = {"bmp", "gif", "jpg", "jpeg", "png"};

    public static final String[] FLASH_EXTENSION = {"swf", "flv"};

    public static final String[] MEDIA_EXTENSION = {"swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
            "asf", "rm", "rmvb"};

    public static final String[] VIDEO_EXTENSION = {"mp4", "avi", "rmvb"};
    //图片
    public static final String[] Picture = {"bmp", "gif", "jpg", "jpeg", "png"};
    //视频
    public static final String[] video = {"mp4", "avi", "rmvb"};
    //音频
    public static final String[] audio = {"mp3", "wav", "flac", "aac", "ogg"};
    //文档
    public static final String[] document = {"doc", "docx", "xls", "xlsx", "ppt", "pdf", "pptx", "html", "htm", "txt", "wps"};

    public static final String[] FILE_TYPE= {"","image", "audio", "video", "document","other"};
    public static final String[][] DEFAULT_EXTENSION = {{""}, Picture, audio, video, document};

    public static String getExtension(String prefix) {
        switch (prefix) {
            case IMAGE_PNG:
                return "png";
            case IMAGE_JPG:
                return "jpg";
            case IMAGE_JPEG:
                return "jpeg";
            case IMAGE_BMP:
                return "bmp";
            case IMAGE_GIF:
                return "gif";
            default:
                return "";
        }
    }
}
